﻿using Abp.Domain.Services;
using Mt.Site.Core.Members.Values;
using System;
using System.Threading.Tasks;

namespace Mt.Site.Core.Members
{
    public interface IMemberManager:IDomainService
    {
        #region Member
        /// <summary>
        /// 登陆信息
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="password">密码</param>
        /// <returns>0：账号或密码错误；1：正常；2：登陆失败</returns>
        Task<LoginResult> LoginInfo(string userName,string password, bool isPersistent);

        /// <summary>
        /// 注册会员
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<Guid> RegisterMember(Member input);

        /// <summary>
        /// 删除会员
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        Task DeleteMember(Guid ID);

        /// <summary>
        /// 重置密码111111
        /// </summary>
        /// <param name="ID"></param>
        Task ResetPassword(Guid ID);


        Task UpdateMemberAsync(Member input);
        #endregion

        #region MemberInfo

        Task AddOrUpdateMemberInfoAsync(MemberInfo memberInfo);

        /// <summary>
        /// 读取用户资料（前台） ，不存在时自动new一个新实例
        /// </summary>
        /// <param name="memberID"></param>
        /// <param name="isMemberInfoLocalizated">MemberFeatures.MemberInfoLocalization</param>
        /// <returns></returns>
        Task<MemberInfo> FirstOrDefaultMemberInfoAsync(Guid memberID, bool isMemberInfoLocalizated);
        #endregion

        /// <summary>
        /// 前台用户在线信息
        /// </summary>
        /// <param name="memberID"></param>
        /// <returns></returns>
        Task<MemberCacheItem> GetMemberCacheItemById(MemberCookieItem member);


        /// <summary>
        /// 获取用户邮箱
        /// </summary>
        /// <param name="EmailOrUsername"></param>
        /// <returns></returns>
        Task<string> GetEamil(string EmailOrUsername);

        Task<EmailinfoDto> GetEamil2(string EmailOrUsername);
    }
}
